//
//  Contact.m
//  04- 集合02
//
//  Created by dllo on 16/7/7.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "Contact.h"

@implementation Contact
- (instancetype)initWithName:(NSString *)name phoneNum:(NSString *)phoneNum {
    self = [super init];
    if (self) {
        _name = [name capitalizedString];
        _phoneNum = phoneNum;
        _groupName = [[name substringToIndex:1] uppercaseString];
    }
    return  self;
}
+ (instancetype)contactWithName:(NSString *)name phoneNum:(NSString *)phoneNum {
    return [[Contact alloc]initWithName:name phoneNum:phoneNum];
}
- (void)showContact {
    NSLog(@"name:%@ phoneNum:%@",self.name,self.phoneNum);
}
- (NSString *)description {
    return [NSString stringWithFormat:@"%@ %@",self.name,self.phoneNum];
}
@end
